package com.happiness.base.http;

import com.happiness.base.enums.ResultCodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 返回实体信息
 * */
@Data
@Builder
@ApiModel("实体返回数据信息")
@EqualsAndHashCode(callSuper = false)
public class ResultInfo implements Serializable {
    @ApiModelProperty("状态码")
    private Integer code;
    @ApiModelProperty("返回消息")
    private String message;
    @ApiModelProperty("返回内容")
    private Object data;

    public ResultInfo() {
    }

    public ResultInfo(ResultCodeEnum codeEnum) {
        this.code = codeEnum.code;
        this.message = codeEnum.message;
    }

    public ResultInfo(ResultCodeEnum codeEnum,Object data) {
        this.code = codeEnum.code;
        this.message = codeEnum.message;
        this.data = data;
    }
    public ResultInfo(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultInfo(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public ResultInfo(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}

